import 'package:flutter_test/flutter_test.dart';
import 'package:component_scanner/component_scanner.dart';
import 'package:component_scanner/component_scanner_platform_interface.dart';
import 'package:component_scanner/component_scanner_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockComponentScannerPlatform
    with MockPlatformInterfaceMixin
    implements ComponentScannerPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final ComponentScannerPlatform initialPlatform = ComponentScannerPlatform.instance;

  test('$MethodChannelComponentScanner is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelComponentScanner>());
  });

  test('getPlatformVersion', () async {
    ComponentScanner componentScannerPlugin = ComponentScanner();
    MockComponentScannerPlatform fakePlatform = MockComponentScannerPlatform();
    ComponentScannerPlatform.instance = fakePlatform;

    expect(await componentScannerPlugin.getPlatformVersion(), '42');
  });
}
